#ifndef _SOLUTION_H
#define _SOLUTION_H

#include "GlobalDefines.h"
#include "Geometry.h"
#include "Excitation.h"
class Solution
{
public:
	Solution(TriangleMesh* obj, Excitation* ex):Object(obj),Ex(ex){};
	virtual ~Solution(){};
	bool Analysis();
	emx::real_data T(int j, emx::real_data t);
private:
	bool Initial();
	emx::real_data Singular(int patchIdx);
	emx::Real3D Calculate_K(int fieldIdx, int sourceIdx);
	emx::real_data Calculate_phi(int fieldIdx, int sourceIdx, int flag);
	emx::real_data I_Integral(int edgeIdx, emx::real_data t);
	emx::real_data Phi(int patchIdx, int j);
	emx::Real3D A(int edgeIdx, int j);
	emx::Real3D _A(int edgeIdx, int j);
private:
	TriangleMesh* Object;
	Excitation* Ex;
	emx::real_data Delta;
	blitz::Array<emx::Real3D, 2> K;
	blitz::Array<emx::real_data, 3> phi;
	emx::dMatrix I;
};

#endif
